\documentclass[crop,tikz]{standalone}
\usepackage{tikz}

\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning}

\definecolor{echoreg}{HTML}{2cb1e1}
\definecolor{olivegreen}{rgb}{0,0.6,0}
\definecolor{mymauve}{rgb}{0.58,0,0.82}

\usepackage{etoolbox}

\newtoggle{redraw}
\newtoggle{redraw2}

\tikzset{%
pics/cube/.style args={#1/#2/#3/#4}{code={%
	\begin{scope}[line width=#4mm]
	\begin{scope}
	\clip (-#1,-#2,0) -- (#1,-#2,0) -- (#1,#2,0) -- (-#1,#2,0) -- cycle;
	\filldraw (-#1,-#2,0) -- (#1,-#2,0) -- (#1,#2,0) -- (-#1,#2,0) -- cycle;
	\end{scope}
\iftoggle{redraw}{%
}{%
	\begin{scope}
	\clip (-#1,-#2,0) -- (-#1-#3,-#2,-#3) -- (-#1-#3,#2,-#3) -- (-#1,#2,0) -- cycle;
	\filldraw (-#1,-#2,0) -- (-#1-#3,-#2,-#3) -- (-#1-#3,#2,-#3) -- (-#1,#2,0) -- cycle;
	\end{scope}
}
\iftoggle{redraw2}{%
}{
	\begin{scope}
	\clip (-#1,#2,0) -- (-#1-#3,#2,-#3) -- (#1-#3,#2,-#3) -- (#1,#2,0) -- cycle;
	\filldraw (-#1,#2,0) -- (-#1-#3,#2,-#3) -- (#1-#3,#2,-#3) -- (#1,#2,0) -- cycle;
	\end{scope}
}
	\node[inner sep=0] (-A) at (-#1-#3*0.5, 0, -#3*0.5) {};
	\node[inner sep=0] (-B) at (#1-#3*0.5, 0, -#3*0.5) {};
	
	\coordinate (-V) at (#1, #2);
	\coordinate (-W) at (#1, -#2);
	\end{scope}
}}}

\begin{document}
\begin{tikzpicture}

	\node (1) [draw, dashed, minimum height=15em, minimum width=62em, xshift=24em, fill=olivegreen, fill opacity=0.2, very thick, rectangle, rounded corners] {};
		\node (la1) [below=0em of 1] {{\emph{encoder}}};
	\node (2) [draw, dashed, minimum height=14em, fill = red, fill opacity=0.2,minimum width=35em, xshift=63.5em, very thick, rectangle, rounded corners] {};
		\node (la1) [below=0em of 2] {{\emph{decoder}}};

	\node[] (i2) {};
	\pic[fill=green!50] (I2) {cube={1.8/1.8/0.4/1}};
	
	\togglefalse{redraw}
	\togglefalse{redraw2}
	
  	\node[right=16em of i2] (y) {};
  	
  	\pic[right=16em of i2, fill=echoreg!50] (Y) {cube={1.8/1.8/1/1}};
  	
  	\node[right=12em of y] (y1) {};
  	\pic[right=12em of y, fill=red!50] (Y1) {cube={0.9/0.9/1/1}};
  	
  	\node[right=12em of y1] (y2) {};
  	\pic[right=12em of y1, fill=echoreg!50] (Y2) {cube={0.9/0.9/2/1}};
  	\node[right=10em of y2] (y3) {};
  	\pic[right=10em of y2, fill=red!50] (Y3) {cube={0.45/0.45/2/1}};
  	
  	\node[right=9em of y3] (z1) {};
  	\pic[right=9em of y3, fill=mymauve!50] (Z1) {cube={0.9/0.9/1/1}};
  	
  	\node[right=12em of z1] (z2) {};
  	\pic[right=12em of z1, fill=mymauve!50] (Z2) {cube={1.8/1.8/0.4/1}};
  	
  	\draw [-stealth, ultra thick] (I2-B) -- node[above] {Conv.} node[below] {ReLU} (Y-A);
  	
  	\draw [-stealth, ultra thick] (Y-B) -- node[above] {Pool} (Y1-A);
  	
  	\draw [-stealth, ultra thick] (Y1-B) -- node[above=0.3em, inner sep=0.1em] {Conv.} node[below] {ReLU} (Y2-A);
  
  	\draw [-stealth, ultra thick] (Y2-B) -- node[above] {Pool} (Y3-A);
  	
  	
  	\draw [-stealth, ultra thick] (Y3-B) -- node[above] {Deconv.} node[below] {ReLU} (Z1-A);
  	
  	\draw [-stealth, ultra thick] (Z1-B) -- node[above] {Deconv.} node[below] {logistic} (Z2-A);
  	
  	
  	\color{black}
  	
  	\toggletrue{redraw}
  	\toggletrue{redraw2}
  	
  	\node[right=16em of i2] (y) {};
  	\pic[right=16em of i2, fill=echoreg!50] (Y) {cube={1.8/1.8/1/1}};
  	
  	\pic[right=12em of y, fill=red!50] (Y1) {cube={0.9/0.9/1/1}};
  	
  	\pic[right=12em of y1, fill=echoreg!50] (Y2) {cube={0.9/0.9/2/1}};
  	
  	\pic[right=9em of y3, fill=mymauve!50] (Z1) {cube={0.9/0.9/1/1}};
  	
  	\togglefalse{redraw2}
  	
  	\pic[right=10em of y2, fill=red!50] (Y3) {cube={0.45/0.45/2/1}};
  	
  	\toggletrue{redraw2}
  	
	\node[] (i2) {\LARGE ${\bf X}$};
  	\node[right=9.25em of y2] (y3) {\LARGE ${\bf z}$};
  	\node[right=11em of z1] (z2) {\LARGE ${\bf X}'$};

\end{tikzpicture}
\end{document}